//
//  Logger.java
//  
//
//  Created by madsfabriciusschmidt on 04/09/08.
//  Copyright 2008 __MyCompanyName__. All rights reserved.
//
import java.io.*;
import lejos.nxt.*;
public class Logger {

private File log;
private BufferedWriter bw;
private FileOutputStream fos;

/*
* Contructor that takes the name of what to take samples of.
*/
public Logger(String name) throws IOException{
	log = new File(name);
	fos = new FileOutputStream(log);
	log.createNewFile();
	bw = new BufferedWriter(fos);
	bw.write("Time:     data:");
	bw.newLine();
	bw.flush();
	
}

public void log(long time, int sample) throws IOException{
	bw.write(time + "     " + sample);
	bw.newLine();
	bw.flush();
}

public void close()throws IOException{
	fos.close();
}

}
